#include "player.h"
#include "commonFunc.h"
#include <iostream>

using std::list;
using namespace std;

player::player()
{
    //please NEVER call this
}
player::player(int nmaxhp, int ndiff, int nlevel, int ncash)
{
    maxhp = 10;
    curhp = 10;
    diff = 1;
    level = 1;
    cash = 10;
    
}
void player::reset(){
    curhp = maxhp;
}
/*void player::damage(int dmg){
    //cout << "Health Before: " << curhp << endl;
    curhp -= dmg;
    //cout << "Health After: " << curhp << endl;
}*/
player::~player()
{

}

bool player::purchase(int amt)
{//If you can subtract the cash it subtracts it and returns true, if not it doesn't change the cash and returns false
    if (amt <= cash)
    {
#if purchaseDebug == 1
	cout << "Purchasing $" << amt << ". New cash: $" << cash-amt << endl;
#endif
	cash -= amt;
	return true;
    }
#if purchaseDebug == 1
    cout << "Fail purchase $" << amt << ". Current cash: $" << cash << endl;
#endif
    return false;
}

void player::grantMoney(int amt)
{
    cash += amt;
#if purchaseDebug == 1
    cout << "Granting $" << amt << " New Total $" << cash << endl;
#endif
}
